set(SOURCES
    ConsoleProgressBar.cpp
    ConsoleProgressIndicator.cpp
    disk.cpp
    Distribution.cpp
    filesystem.cpp
    HandleConsoleProgressBar.cpp
    hcs.cpp
    helpers.cpp
    interop.cpp
    ExecutionContext.cpp
    socket.cpp
    hvsocket.cpp
    Localization.cpp
    lxssbusclient.cpp
    lxssclient.cpp
    LxssMessagePort.cpp
    LxssServerPort.cpp
    Redirector.cpp
    registry.cpp
    relay.cpp
    string.cpp
    SubProcess.cpp
    svccomm.cpp
    svccommio.cpp
    WslClient.cpp
    WslCoreConfig.cpp
    WslCoreFirewallSupport.cpp
    WslCoreNetworkingSupport.cpp
    WslInstall.cpp
    WslSecurity.cpp
    WslTelemetry.cpp
    wslutil.cpp
    notifications.cpp)

set(HEADERS
    ../../../generated/Localization.h
    ../../shared/inc/CommandLine.h
    ../../shared/inc/defs.h
    ../../shared/inc/lxfsshares.h
    ../../shared/inc/lxinitshared.h
    ../../shared/inc/SocketChannel.h
    ../../shared/inc/socketshared.h
    ../../shared/inc/hns_schema.h
    ../../shared/inc/JsonUtils.h
    ../../shared/inc/stringshared.h
    ../../shared/inc/retryshared.h
    ../../shared/inc/message.h
    ../../shared/inc/prettyprintshared.h
    ../inc/WslPluginApi.h
    ../inc/wslpolicies.h
    ../inc/lxssbusclient.h
    ../inc/lxssclient.h
    ../inc/LxssDynamicFunction.h
    ../inc/traceloggingconfig.h
    ../inc/wdk.h
    ../inc/wsl.h
    ../inc/wslconfig.h
    ../inc/wslhost.h
    ../inc/wslrelay.h
    ConsoleProgressBar.h
    ConsoleProgressIndicator.h
    disk.hpp
    Distribution.h
    filesystem.hpp
    hcs.hpp
    hcs_schema.h
    helpers.hpp
    HandleConsoleProgressBar.h
    interop.hpp
    ExecutionContext.h
    socket.hpp
    hvsocket.hpp
    LxssMessagePort.h
    LxssPort.h
    LxssServerPort.h
    precomp.h
    Redirector.h
    registry.hpp
    relay.hpp
    string.hpp
    Stringify.h
    SubProcess.h
    svccomm.hpp
    svccommio.hpp
    WslClient.h
    WslCoreConfig.h
    WslCoreFirewallSupport.h
    WslCoreNetworkingSupport.h
    WslInstall.h
    WslSecurity.h
    WslTelemetry.h
    wslutil.h
    notifications.h)

add_library(common STATIC ${SOURCES} ${HEADERS})
add_dependencies(common wslserviceidl localization wslservicemc wslinstalleridl)

target_precompile_headers(common PRIVATE precomp.h)
set_target_properties(common PROPERTIES FOLDER windows)
target_include_directories(common PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/../service/mc/${TARGET_PLATFORM}/${CMAKE_BUILD_TYPE})
